package cn.chenfeifx.example.ui;

import cn.chenfeifx.core.common.ResourcesLoader;
import cn.chenfeifx.core.controls.CFTab;
import cn.chenfeifx.core.controls.CFTabPane;
import javafx.geometry.Insets;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;

public class Reward extends StackPane {

    private final CFTabPane cfTabPane;

    private final ImageView wxImageView = ResourcesLoader.loadFxImageView("/img/pay-wx.jpg", 260, 260);
    private final ImageView zfbImageView = ResourcesLoader.loadFxImageView("/img/pay-zfb.jpg", 260, 260);

    public Reward() {
        setPadding(new Insets(50));
        cfTabPane = new CFTabPane();
        getChildren().add(cfTabPane);
        //
        CFTab wxTab = new CFTab("微信",false);
        wxTab.setSelected(true);
        CFTab zfbTab = new CFTab("支付宝",false);
        cfTabPane.getTabs().addAll(wxTab, zfbTab);
        cfTabPane.setTabResult(param -> {
            if (cfTabPane.getTabs().indexOf(param) == 0) { // 微信
                return wxImageView;
            }
            return zfbImageView;
        });
    }
}